﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - 远程报警系统</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
    <style>
        body, html {
            height: 100%;
            margin: 0;
            margin-left: 5%;
            margin-right: 5%;
            padding: 0;
        }

        .nav-item {
            margin-left: 20px;
        }

        .dot {
            height: 20px;
            width: 20px;
            border-radius: 50%;
            display: inline-block;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    
        <header>
        <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
            <div class="container-fluid">
                <a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">设备远程报警系统</a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
                    <ul class="navbar-nav flex-grow-1">
                        <li class="nav-item">
                            <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">首页</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Journal">日志</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="RunningEquipment">监听列表</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link text-dark" asp-area="" asp-controller="SystemConfiguration" asp-action="SystemSettings">系统设置</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link text-dark" href="/Currency/GetClient" target="_blank">客户端下载</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link text-dark" href="/Currency/GetEnvironment" target="_blank">运行环境下载</a>
                        </li>
                    </ul>
                </div>
                <div id="statusDot" class="dot"></div>
            </div>
        </nav>
    </header>
    <div class="container">
        <main role="main" class="pb-3">
            @RenderBody()
        </main>
    </div>
@*     <footer class="border-top footer text-muted">
        <div class="container">
            &copy; 2024 - 设备远程报警系统
        </div>
    </footer> *@
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="~/js/site.js" asp-append-version="true"></script>
    @await RenderSectionAsync("Scripts", required: false)
    <script>
        const apiUrl = '/AlarmSending/GetSmsAlarmStatus';

        fetch(apiUrl)
            .then(response => {
                if (!response.ok) {
                    throw new Error('Network response was not ok');
                }
                return response.json();
            })
            .then(boolValue => {
                const dot = document.getElementById('statusDot');
                if (boolValue) {
                    dot.style.backgroundColor = 'green';
                } else {
                    dot.style.backgroundColor = 'red';
                }
            })
            .catch(error => {
                console.error('Error fetching data or parsing response:', error);
                // 你也可以在这里设置一个默认的颜色或显示错误信息
                const dot = document.getElementById('statusDot');
                dot.style.backgroundColor = 'gray'; // 示例：如果出错，则设置为灰色
            });
    </script>
</body>
</html>
